package com.gduf.bbl.controller;

import java.util.Arrays;
import java.util.Map;


import com.gduf.bbl.common.utils.PageUtils;
import com.gduf.bbl.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.gduf.bbl.entity.WalletsEntity;
import com.gduf.bbl.service.WalletsService;




/**
 * 
 *
 * @author xqw
 * @email 2041411595@qq.com
 * @date 2024-02-29 20:38:49
 */
@RestController
@RequestMapping("bbl/wallets")
@CrossOrigin(allowCredentials = "true")
public class WalletsController {
    @Autowired
    private WalletsService walletsService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = walletsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		WalletsEntity wallets = walletsService.getById(id);

        return R.ok().put("wallets", wallets);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody WalletsEntity wallets){
		walletsService.save(wallets);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody WalletsEntity wallets){
		walletsService.updateById(wallets);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		walletsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
